home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_09_01
/
9n01105b
< prev
next >
Wrap
Text File
|
1990-10-03
|
860b
|
25 lines
pairs_inuse = argc/2; /* number of patterns */
if (0 == (pairs = (pair *)malloc(pairs_inuse * sizeof(pair)))) {
tcl_error("malloc(%d pairs)",pairs_inuse);
return(TCL_ERROR);
}
timeout_action = eof_action = 0;
for (i = 1, p = pairs;i<argc;i+=2,p++) {
if (!(strcmp(argv[i],"timeout"))) {
p->type = keyword;
timeout_action = argv[i+1];
} else if (!(strcmp(argv[i],"eof"))) {
p->type = keyword;
eof_action = argv[i+1];
} else {
p->type = pattern;
p->pattern = argv[i];
p->action = argv[i+1];
}
}
Listing 7